package models

import "gorm.io/gorm"

type Booking struct {
	gorm.Model
	UserId  int    `gorm:"type:int(3);comment:'用户ID'"`
	HouseId int    `gorm:"type:int(3);comment:'房源ID'"`
	BkDate  string `gorm:"type:varchar(30);comment:'预约日期'"`
	Status  int    `gorm:"type:varchar(20);comment:'订单状态'"`
}

func (b *Booking) CreateOrder() error {
	return DB.Create(&b).Error
}

func (b *Booking) GetBookingByUserId() error {
	return DB.Where("user_id=?", b.UserId).Find(*b).Error
}
